package com.zzusedating.androidapp.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.zzusedating.androidapp.fragments.BBSFragment;
import com.zzusedating.androidapp.fragments.DiscoverFragment;
import com.zzusedating.androidapp.fragments.MeFragment;
import com.zzusedating.androidapp.fragments.RecommendFragment;

public class FragAdapterMain extends FragmentPagerAdapter {
    private RecommendFragment recommendFragment;
    private BBSFragment chatFragment;
    private DiscoverFragment discoverFragment;
    private MeFragment meFragment;

    public FragAdapterMain(FragmentManager fm) {
        super(fm);
        recommendFragment = new RecommendFragment();
        chatFragment = new BBSFragment();
        discoverFragment = new DiscoverFragment();
        meFragment = new MeFragment();
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        switch (position){
            case 0:
                fragment = recommendFragment;
                break;
            case 1:
                fragment = chatFragment;
                break;
            case 2:
                fragment = discoverFragment;
                break;
            case 3:
                fragment = meFragment;
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return 4;
    }
}
